<?php
namespace Admin\Model;
use Think\Model;
class ArcitleModel extends Model {
    /* 
     * 根据父类id,获取子类分类
     * @param number $fid
     * @param num 获取的是几级分类
     */
    function getArcitle($fid=0,$num=1) {
        $this->where("fid=$fid");
        $arr=$this->select();
        $optionStr="";
        $num++;
        $strGang=str_repeat('--', $num-2);
        foreach($arr as $v) {
            $optionStr.="<option value='{$v['id']}'>{$strGang}{$v['title']}</option>";
            //找第一级的子分类
            $optionSon=$this->getArcitle($v['id'],$num);
            $optionStr.=$optionSon;
        }
        return $optionStr;
    }
    
}